From cda0cb3b41e3caa977a064cfd16c0e3f7e64c550 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Fri, 1 Mar 2019 07:37:41 -0700 Subject: [PATCH] incorporate review changes. --- defs.h | 1 - gtm.cc | 14 +++++++++----- main.cc | 8 ++++---- reverse_route.cc | 9 +++++++-- route.cc | 13 +------------ 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/defs.h b/defs.h index 087cb72a5..5684bd26d 100644 --- a/defs.h +++ b/defs.h @@ -745,7 +745,6 @@ void track_del_wpt(route_head* rte, Waypoint* wpt); void route_disp(const route_head* rte, std::nullptr_t /* waypt_cb */); /* override to catch nullptr */ //void route_disp_all(route_hdr, route_trl, waypt_cb); /* template */ //void track_disp_all(route_hdr, route_trl, waypt_cb); /* template */ -void route_reverse(const route_head* rte_hd); void route_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc); void track_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc); void route_flush_all_routes(); diff --git a/gtm.cc b/gtm.cc index c5ab84729..76978377d 100644 --- a/gtm.cc +++ b/gtm.cc @@ -585,13 +585,17 @@ gtm_read() /* Tracklog styles */ // TODO: The format document states there are ts_count tracklog style entries, // and tr_count tracklog entries. - // Some tracklog entries may be contiuation entries, so we turn these into - // real_track_list.size() <= tr_count tracks. - // If ts_count != real_track_list.size() we don't know how to line up the tracklogs, - // and the real tracks, with the tracklog styles. + // Some tracklog entries may be continuation entries, so we turn these + // into real_track_list.size() <= tr_count tracks. + // If ts_count != real_track_list.size() we don't know how to line up + // the tracklogs, and the real tracks, with the tracklog styles. if (ts_count != real_track_list.size()) { - warning(MYNAME ": The number of tracklog entries with the new flag set doesn't match the number of tracklog style entries."); + warning(MYNAME ": The number of tracklog entries with the new flag " + "set doesn't match the number of tracklog style entries.\n" + " This is unexpected and may indicate a malformed input file.\n" + " As a result the track names may be incorrect.\n"); } + // Read the entire tracklog styles section whether we use it or not. for (i = 0; i != ts_count; i++) { QString tname = fread_string(file_in); fread_discard(file_in, 12); diff --git a/main.cc b/main.cc index d19a6fd69..cbf1d3621 100644 --- a/main.cc +++ b/main.cc @@ -228,10 +228,10 @@ run(const char* prog_name) const char* fvec_opts = nullptr; int opt_version = 0; bool did_something = false; - queue* wpt_head_bak; /* #ifdef UTF8_SUPPORT */ - RouteList* rte_head_bak, *trk_head_bak; /* #ifdef UTF8_SUPPORT */ - signed int wpt_ct_bak; /* #ifdef UTF8_SUPPORT */ - bool lists_backedup; /* #ifdef UTF8_SUPPORT */ + queue* wpt_head_bak; + RouteList* rte_head_bak, *trk_head_bak; + signed int wpt_ct_bak; + bool lists_backedup; QStack qargs_stack; // Use QCoreApplication::arguments() to process the command line. diff --git a/reverse_route.cc b/reverse_route.cc index 8868b1a21..3f85066c2 100644 --- a/reverse_route.cc +++ b/reverse_route.cc @@ -40,9 +40,14 @@ void ReverseRouteFilter::reverse_route_wpt(const Waypoint* waypointp) prev_new_trkseg = curr_new_trkseg; } -void ReverseRouteFilter::reverse_route_head(const route_head* rte) +void ReverseRouteFilter::reverse_route_head(const route_head* rte_hd) { - route_reverse(rte); + /* Cast away const-ness */ + auto rh = const_cast(rte_hd); + queue* elem, *tmp; + QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { + ENQUEUE_HEAD(&rh->waypoint_list, dequeue(elem)); + } prev_new_trkseg = 1; } diff --git a/route.cc b/route.cc index 2c5c03319..c3b5742ab 100644 --- a/route.cc +++ b/route.cc @@ -152,17 +152,6 @@ route_disp(const route_head* /* rh */, std::nullptr_t /* wc */) // wc == nullptr } -void -route_reverse(const route_head* rte_hd) -{ - /* Cast away const-ness */ - auto rh = const_cast(rte_hd); - queue* elem, *tmp; - QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { - ENQUEUE_HEAD(&rh->waypoint_list, dequeue(elem)); - } -} - void route_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc) { @@ -447,7 +436,7 @@ RouteList::add_wpt(route_head* rte, Waypoint* wpt, bool synth, const QString& na rte->rte_waypt_ct++; /* waypoints in this route */ ++waypt_ct; if (synth && wpt->shortname.isEmpty()) { - wpt->shortname = QString().sprintf("%s%0*d", CSTRc(namepart), number_digits, waypt_ct); + wpt->shortname = QString("%1%2").arg(namepart).arg(waypt_ct, number_digits, 10, QChar('0')); wpt->wpt_flags.shortname_is_synthetic = 1; } update_common_traits(wpt); -- 2.30.2